/**
 * @description 消息提示框
 * @param {Object} 参数和uni.showToast参数一致
 */
const toast = ({title='数据加载中',icon='none',duration=2000,mask=true}={}) =>{
	uni.showToast({
		title,
		icon,
		duration,
		mask
	})
}
/**
 * @description 模态对话框
 * @param {Object} options和showModal参数一致
 */
const modal = (options={})=>{
	return new Promise((resolve)=>{
		const defaultOpt = {
			title:'提示',
			content:'您确定执行该操作吗？',
			confirmColor:'#f3514f'
		}
		const opts = Object.assign({},defaultOpt,options)
		uni.showModal({
			...opts,
			complete: ({confirm,cancel}) => {
				confirm && resolve(true)
				cancel && resolve(false)
			}
		})
	})
}
export {toast,modal}